package com.xzh.controller;

import com.github.pagehelper.PageInfo;
import com.xzh.common.Result;
import com.xzh.entity.CarHistory;
import jakarta.annotation.Resource;
import com.xzh.service.HistoryService;
import org.springframework.web.bind.annotation.*;

import java.util.Objects;

@RestController
@RequestMapping("/Home/History")
public class HistoryController {

    @Resource
    private HistoryService historyService;

    //页数选择和用户数据查询
    @GetMapping("/selectPage")
    public Result selectPage(
            CarHistory e,
            @RequestParam Integer pageNum,
            @RequestParam Integer pageSize) {
        PageInfo<CarHistory> pageInfo = historyService.selectPage(e,pageNum, pageSize);
        return Result.success(pageInfo);
    }

    @PutMapping("/add")
    public Result add(CarHistory e) {
        historyService.add(e);
        return Result.success();
    }
}
